package com.codedancer.campus.po;

import com.baomidou.mybatisplus.annotation.FieldFill;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.gitee.sunchenbin.mybatis.actable.annotation.Column;
import com.gitee.sunchenbin.mybatis.actable.annotation.Table;
import com.gitee.sunchenbin.mybatis.actable.constants.MySqlTypeConstant;
import java.util.Date;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;

@TableName(value = "menu", autoResultMap = true)
@Table(name = "menu", comment = "菜单")
@Data
@Builder
@NoArgsConstructor
@AllArgsConstructor
public class Menu {

    @TableId
    @TableField("uuid")
    @Column(name = "uuid", type = MySqlTypeConstant.VARCHAR, length = 36, isKey = true, isNull = false, comment = "uuid")
    private String uuid;

    @TableField("parent_uuid")
    @Column(name = "parent_uuid", type = MySqlTypeConstant.VARCHAR, length = 36, isNull = false, comment = "父级uuid", defaultValue = "0")
    private String parentUuid;

    @TableField("name")
    @Column(name = "name", type = MySqlTypeConstant.VARCHAR, length = 16, isNull = false, comment = "菜单名称")
    private String name;

    @TableField("path")
    @Column(name = "path", type = MySqlTypeConstant.VARCHAR, length = 32, isNull = true, comment = "路径")
    private String path;

    @TableField("component_name")
    @Column(name = "component_name", type = MySqlTypeConstant.VARCHAR, length = 64, isNull = false, comment = "组件名称")
    private String componentName;

    @TableField("is_menu")
    @Column(name = "is_menu", type = MySqlTypeConstant.BIT, isNull = false, comment = "是否是菜单，否则是按钮")
    private Boolean isMenu;

    @TableField("is_router")
    @Column(name = "is_router", type = MySqlTypeConstant.BIT, isNull = false, comment = "是否是路由")
    private Boolean isRouter;

    @TableField("icon")
    @Column(name = "icon", type = MySqlTypeConstant.VARCHAR, length = 36, isNull = false, comment = "图标")
    private String icon;

    @TableField("is_hidden")
    @Column(name = "is_hidden", type = MySqlTypeConstant.BIT, isNull = false, comment = "是否隐藏")
    private Boolean isHidden;

    @Column(name = "create_time", type = MySqlTypeConstant.DATETIME, isNull = false, comment = "创建时间")
    @TableField(fill = FieldFill.INSERT_UPDATE)
    @JsonFormat(timezone = "GMT+8", pattern = "yyyy-MM-dd HH:mm:ss")
    private Date createTime;

    @Column(name = "update_time", type = MySqlTypeConstant.DATETIME, isNull = false, comment = "更新时间")
    @TableField(fill = FieldFill.INSERT_UPDATE)
    @JsonFormat(timezone = "GMT+8", pattern = "yyyy-MM-dd HH:mm:ss")
    private Date updateTime;

    @TableField("sort")
    @Column(name = "sort", type = MySqlTypeConstant.INT, length = 2, isNull = false, comment = "排序", defaultValue = "1")
    private Integer sort;
}
